package cn.bearspark.comment.provider.dao.key;

import cn.bearspark.framework.redis.starter.buffer.hash.un.RedisHashBufferKeyBuilder;
import cn.bearspark.framework.redis.starter.buffer.list.RedisPageListBufKeyBuilder;
import cn.bearspark.framework.redis.starter.key.RedisKeyBuilder;
import org.springframework.stereotype.Component;

/**
 * 层评论的缓存器的键的构造器
 *
 * @author f
 */
@Component
public class LayerCommentBufferKeyBuilder extends RedisKeyBuilder
        implements RedisHashBufferKeyBuilder, RedisPageListBufKeyBuilder {

    /**
     * 层评论数据 的缓存的键的前缀
     */
    private static final String LAYER_COMMENT_INFO = "layerCommentInfo";

    /**
     * 层评论 id 的缓存的键的前缀
     */
    private static final String LAYER_COMMENT_ID_INFO = "layerCommentIdInfo";

    @Override
    public String buildHashBufferKey(long id) {
        return super.getPrefix() + LAYER_COMMENT_INFO + super.getSplitItem() + id;
    }

    @Override
    public String buildPageListBufKey(long bldgCommentId) {
        return super.getPrefix() + LAYER_COMMENT_ID_INFO + super.getSplitItem() + bldgCommentId;
    }
}
